package 代码记录.指定公司代码练习记录.华为_2024.分值100;

import java.util.*;

/**
 * @author zx
 * @create 2024-02-02 20:06
 * map的按照value排序变种;自己做出来了
 */
public class 按身高和体重排队_25 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] heights = new int[n];
        int[] weights = new int[n];
        for(int i = 0;i < n;i++){
            heights[i] = sc.nextInt();
        }
        for(int i = 0;i < n;i++){
            weights[i] = sc.nextInt();
        }
        Map<Integer,int[]> map = new HashMap<>();
        for(int i = 0;i < n;i++){
            map.put(i + 1,new int[]{heights[i],weights[i]});
        }
        List<Map.Entry<Integer,int[]>> entries = new ArrayList<>(map.entrySet());
        entries.sort(new Comparator<Map.Entry<Integer, int[]>>() {
            @Override
            public int compare(Map.Entry<Integer, int[]> o1, Map.Entry<Integer, int[]> o2) {
                if(o1.getValue()[0] == o2.getValue()[0]){
                    return o1.getValue()[1] - o2.getValue()[1];
                }else{
                    return o1.getValue()[0] - o2.getValue()[0];
                }
            }
        });
        for (Map.Entry<Integer, int[]> entry : entries) {
            System.out.print(entry.getKey() + " ");
        }
    }
}
